package lanqiao.dontaiguihua;
import java.util.Arrays;
import java.util.Scanner;

public class Lan1456 {
    static int N = 5050;
    static char[] a = new char[N];
    static long[][] dp = new long[N][N];
    static int p;
     static int mod = (int)(1e9+7);

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String n = sc.next();

        for (int i = 1; i <= n.length(); i++) {
            a[i] = n.charAt(i - 1);
        }
        p = n.length();
        long l = tr();
        for(int i=1,j=p;i<=j;i++,j--){
            char h=a[i];
            a[i]=a[j];
            a[j]=h;
        }
        for(int i=1;i<=p;i++) {
            if(a[i]=='(')
            {
                a[i]=')';
            }
            else
                a[i]='(';
        }
        long l1=tr();
        System.out.println(l*l1%mod);
        sc.close();
    }
    private static long tr() {
        for(long[] t:dp)
            Arrays.fill(t,0);
        dp[0][0] = 1;
        for (int i = 1; i <= p; i++) {
            if (a[i] == '(') {
                for(int j=1;j<=p;j++)
                    dp[i][j] = dp[i - 1][j - 1];

            } else {
                dp[i][0] = dp[i - 1][0] + dp[i - 1][1];
                for (int j = 1; j <= p; j++) {
                dp[i][j]=(dp[i-1][j+1]+dp[i][j-1])%mod;
                }
            }

        }

        for(int i=0;i<=p;i++){
            if(dp[p][i]!=0){
                return dp[p][i];
            }
        }
        return -1;
    }
}


